home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1997 February
/
EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso
/
progs
/
editor
/
frexxed
/
fpl
/
hexedit.fpl
< prev
next >
Wrap
Text File
|
1995-07-18
|
1KB
|
41 lines
export int he_oldval;
export int he_oldcount=-2;
export void HexEdit(string input)
{
if (strlen(input)==1) {
int val=strtol(input, 16);
int oldchar=0, oldinsert=ReadInfo("insert_mode");
if (val!=0 || input[0]=='0') {
oldchar=GetChar();
if (he_oldcount==ReadInfo("counter")-1) {
he_oldval=(oldchar&240)+val;
he_oldcount=-2;
} else {
he_oldval=(oldchar&15)+(val<<4);
he_oldcount=ReadInfo("counter");
}
if (he_oldval!=oldchar) {
Visible(0);
input[0]=he_oldval;
SetInfo(-1, "insert_mode", 0);
Clean(joinstr("Output(\"",CConvertString(input),"\");"));
SetInfo(-1, "insert_mode", oldinsert);
if (he_oldcount!=-2)
CursorLeft();
else if (Isnewline(he_oldval))
Delete();
} else if (he_oldcount==-2)
CursorRight();
ReturnStatus("");
return(1);
}
}
return(0);
}
ConstructInfo("hex_edit", "", "", "LB(system)", "", 0, 1, 0);
Hook("Output", "HexEdit", "hex_edit");